﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Private edtnewpass2 As EditText
	Private edtnewpass As EditText
	Private edtoldpass As EditText
	Private btnleft As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("laymodifypass")
	initviews
End Sub
Sub initviews
	comm.AIO(Activity)
	comm.setFA(btnleft,"fa-angle-left","")
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub JobDone(thj As HttpJob)
	ProgressDialogHide
	If thj.Success Then
		Dim str As String=thj.GetString
		Dim nr As netRes=ParseHelper.getStatusData(str)
		If nr.nCode=200 Then
			Select thj.JobName
			Case "modpass"
				ParseHelper.updateCookie(thj.GetHeader) '更新cookies
				comm.T("密码修改成功")
				Activity.Finish
			End Select
		Else
			comm.TL("错误:"&nr.sData)
		End If
	Else
		comm.TL("网络错误:"&thj.JobName&thj.ErrorMessage)
	End If
	thj.Release
End Sub
Sub ivback_Click
	Activity.Finish
End Sub
Private Sub reqModifyPass(oldPass As String,newPass As String)
	comm.showProgress("正在提交")
	ParseHelper.doPostReqArr(Me,"modpass",comm.getApi(comm.apiIdx.MODIFYPASS),Array As String("jiu_pwd",oldPass,"pwd",newPass),"")
End Sub
Sub btnsubmit_Click
	If edtoldpass.Text.Trim.Length<1 Then
		comm.TL("原密码不能为空!")
	Else
		If edtnewpass.Text.Trim.Length>0 And edtnewpass.Text.CompareTo(edtnewpass2.Text)=0 Then
			reqModifyPass(edtoldpass.Text.Trim,edtnewpass.Text.Trim)		
		Else
			comm.TL("新密码不能为空或两次输入的不同请重新输入")
		End If
	End If
	
	'ToastMessageShow("submit",False)
	
End Sub